package com.micro.school.order.controller;

import com.micro.school.common.core.context.SecurityContextHolder;
import com.micro.school.common.core.web.controller.BaseController;
import com.micro.school.common.core.web.domain.AjaxResult;
import com.micro.school.common.core.web.page.TableDataInfo;
import com.micro.school.common.log.annotation.Log;
import com.micro.school.common.log.enums.BusinessType;
import com.micro.school.order.entity.PayOrderImportRecord;
import com.micro.school.order.service.PayOrderImportRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * 【请填写功能名称】Controller
 * 
 * @author rakic
 * @date 2025-08-05
 */
@RestController
@RequestMapping("/orderImportRecord")
public class PayOrderImportRecordController extends BaseController
{
    @Autowired
    private PayOrderImportRecordService payOrderImportRecordService;

    /**
     * 查询导入详细记录
     */
    @GetMapping("/list")
    public TableDataInfo list(PayOrderImportRecord payOrderImportRecord)
    {
        startPage();
        if (!SecurityContextHolder.getUserName().equals("admin")) {
            payOrderImportRecord.setCreateBy(SecurityContextHolder.getUserName());
        }
        List<PayOrderImportRecord> list = payOrderImportRecordService.selectPayOrderImportRecordList(payOrderImportRecord);
        return getDataTable(list);
    }

    /**
     * 查询导入详细记录
     */
    @PostMapping("/listMessage")
    public AjaxResult listMessage(@RequestBody PayOrderImportRecord payOrderImportRecord)
    {
        Map<String,Object> list = payOrderImportRecordService.listMessage(payOrderImportRecord);
        return AjaxResult.success(list);
    }

    /**
     * 删除导入详细记录
     */
    @Log(title = "删除导入详细记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long ids)
    {
        return toAjax(payOrderImportRecordService.remove(ids));
    }


}
